//
//  UIView+Layout.m
//  sevense
//
//  Created by mac003 on 7/26/13.
//  Copyright (c) 2013 2xi. All rights reserved.
//

#import "UIView+Layout.h"

@implementation UIView (Layout)

- (CGFloat)frameX
{
    return self.frame.origin.x;
}

-(void)setFrameX:(CGFloat)x
{
    CGRect localFrame = self.frame;
    localFrame.origin.x = x;
    
    self.frame = localFrame;
}

- (CGFloat)frameY
{
    return self.frame.origin.y;
}

-(void)setFrameY:(CGFloat)y
{
    CGRect localFrame = self.frame;
    localFrame.origin.y = y;
    
    self.frame = localFrame;
}

- (CGFloat)frameWidth
{
    return self.frame.size.width;
}

-(void)setFrameWidth:(CGFloat)width
{
    CGRect localFrame = self.frame;
    localFrame.size.width = width;
    
    self.frame = localFrame;
}

- (CGFloat)frameHeight
{
    return self.frame.size.height;
}

-(void)setFrameHeight:(CGFloat)height
{
    CGRect localFrame = self.frame;
    localFrame.size.height = height;
    
    self.frame = localFrame;
}

- (CGFloat)frameMaxX
{
    return CGRectGetMaxX(self.frame);
}

- (CGFloat)frameMaxY
{
    return CGRectGetMaxY(self.frame);
}

static NSInteger count = 0;

- (void)listAllSubview
{
    count++;
    for (UIView *view in self.subviews)
    {
        [view listAllSubview];
    }
}

- (NSInteger)allSubviewCount
{
    count = 0;
    [self listAllSubview];
    count--;
    
    return count;
}

@end
